//引用vue，vue-router
import Vue from "vue";
import Router from "vue-router";
//引入页面
import home from "../views/home.vue";
import movie from "../views/movie.vue";
import movieHot from "../views/hot.vue";
import movieComing from "../views/coming.vue";
import details from "../views/details.vue";
import citys from "../views/citys.vue";
Vue.use(Router);

//配置组件的路径和注册
//const表示不可被修饰的常量
const routes = [{
		path: "/",
		redirect: 'home',
	},
	{
		//路由名称
		name: "home",
		//路由路径
		path: "/home",
		//作为模板引入
		component: home,
	},
	{
		//路由名称
		name: "movie",
		//路由路径
		path: "/movie",
		//作为模板引入
		component: movie,
		children: [{
				path: "/",
				redirect: 'hot',
			},
			{
				path: '/movie/hot',
				component: movieHot
			},
			{
				path: '/movie/coming',
				component: movieComing
			}
		]
	},
	{
		name: "details",
		//路由路径
		path: "/details",
		//作为模板引入
		component: details,
	},
	{
		name: "citys",
		//路由路径
		path: "/citys",
		//作为模板引入
		component: citys,
	}
]

//创建vue-router的实例
//注意：Router对象的路由配置，属性名为routes，切记不要改动
const router = new Router({
	routes: routes
});
//输出给其他文件使用router对象
export default router;